# pip install 'crewai-tools[mcp]'
from globle import envs
from crewai import Agent,LLM
from crewai_tools import MCPServerAdapter

# CrewAI
llm = LLM(
        model="openai/deepseek-chat",  # 注意前面加openai
        base_url="https://api.deepseek.com/v1",
        temperature=0.1,
        max_tokens=256,
    )

server_params = {
    "url": "http://127.0.0.1:8000/sse",
    "transport": "sse"
}


with MCPServerAdapter(server_params) as mcp_tools:

    print(f"支持的tool: {[tool.name for tool in mcp_tools]}")
    my_agent = Agent(
        llm=llm,
        role="MCP助手",
        goal="用工具帮助用户",
        backstory="有很多工具的助手",
        tools=mcp_tools
    )

    r = my_agent.kickoff("1+2等于几")
    print(r)

